// 引入Service和请求头ServiceName
import { Service, ServiceName } from '@/network/http.js'
import store from '@/store/index.js' // 引入store

const api = {
    /**
        * 获取主列表数据
        */
    getData (params) {
        return Service.get(
            `/${ServiceName}/api/external/CostRateController/queryall`, { params }
        )
    },
    /**
      * 修改
      */
    updateData (params) {
        store.commit('changeStatus', true)
        return Service.put(
            `/${ServiceName}/api/external/CostRateController/update`,params
        )
    },
    /**
     * 删除
     */
    deleteData (id) {
        return Service.delete(
            `/${ServiceName}/api/external/CostRateController/deletebyid?id=${id}`
        )
    },
    /**
     * 新增
     */
    addData(params) {
        store.commit('changeStatus', true)
        return Service.post(
            `/${ServiceName}/api/external/CostRateController/insert`,params
        )
    },
    /**
     * 根据Id查询
     */
    getDataById(id) {
        return Service.get(
            `/${ServiceName}/api/external/CostRateController/querybyid?id=${id}`
        )
    },
}

export default api
